﻿<UserControl
	xmlns="http://schemas.microsoft.com/client/2007"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
	xmlns:sipsorcery="clr-namespace:SIPSorcery;assembly=SIPSorcery" 
	xmlns:sipsorceryui="clr-namespace:SIPSorcery.UIControls;assembly=SIPSorcery"  
	mc:Ignorable="d"
	x:Class="SIPSorcery.SIPAccountManager"
	d:DesignWidth="800" Width="1024" xmlns:SIPSorcery="clr-namespace:SIPSorcery" OpacityMask="{x:Null}" Height="Auto" HorizontalContentAlignment="Center" VerticalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" d:DesignHeight="471.448">

	<UserControl.Resources>
		<sipsorcery:SIPURIConverter x:Key="SIPURIStringConverter" />
		<sipsorcery:SIPParameterlessURIConverter x:Key="SIPParameterlessURIStringConverter" />
		<sipsorcery:DateTimeOffsetConverter x:Key="DateTimeOffsetConverter" />
		<sipsorcery:DateTimeConverter x:Key="DateTimeConverter" />
		<sipsorcery:PasswordConverter x:Key="PasswordConverter" />
	</UserControl.Resources>

	<StackPanel Height="Auto" x:Name="m_sipAccountManagerGrid" Width="Auto" Background="#FF000000" ScrollViewer.VerticalScrollBarVisibility="Disabled">
		<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_sipAccountsPanel" Width="Auto" Margin="0,5,0,5" MinHeight="150" MinWidth="1024">
			<Border BorderBrush="#FFA1FA28" BorderThickness="1,1,1,1" Height="222" x:Name="m_listBorder" Width="1024">
				<data:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_sipAccountsDataGrid" AutoGenerateColumns="False" FontSize="11" 
					RowBackground="Azure"
	            	AlternatingRowBackground="LightSteelBlue" MouseLeftButtonUp="SIPAccountsDataGrid_MouseLeftButtonUp">
					 <data:DataGrid.Columns>
		                <data:DataGridTextColumn 
		                    Header="Username" 
		                    Width="SizeToCells"
		                    Binding="{Binding SIPUsername}" 
							IsReadOnly="True"
							MinWidth="100"/>
						<data:DataGridTextColumn 
		                    Header="Domain" 
		                    Width="SizeToCells"
		                    Binding="{Binding SIPDomain}" 
							IsReadOnly="True"
							MinWidth="100" />
						<data:DataGridTemplateColumn Header="Password" MinWidth="90">
							<data:DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
								    <StackPanel MouseEnter="ShowPassword" MouseLeave="HidePassword">
								    	<TextBlock Text="●●●●●●"  />
										<TextBlock Text="{Binding SIPPassword}" Visibility="Collapsed"/>
									</StackPanel>
								</DataTemplate>
							</data:DataGridTemplateColumn.CellTemplate>
						</data:DataGridTemplateColumn>
						<data:DataGridTextColumn 
		                    Header="Owner" 
		                    Width="SizeToCells"
		                    Binding="{Binding Owner}" 
							IsReadOnly="True"
							MinWidth="80" />
						<data:DataGridTextColumn 
		                    Header="Out Dial Plan" 
		                    Width="SizeToCells"
		                    Binding="{Binding OutDialPlanName}" 
							IsReadOnly="True"
							MinWidth="90" />
						<data:DataGridCheckBoxColumn 
							Header="Keep Alives" 
		                    Width="SizeToCells"
		                    Binding="{Binding SendNATKeepAlives}" 
							IsReadOnly="True"
							MinWidth="80" 	/>
						<data:DataGridCheckBoxColumn 
							Header="In Only" 
		                    Width="SizeToCells"
		                    Binding="{Binding IsIncomingOnly}" 
							IsReadOnly="True"
							MinWidth="60" />
						<data:DataGridTextColumn 
		                    Header="In Dial Plan" 
		                    Width="SizeToCells"
		                    Binding="{Binding InDialPlanName}" 
							IsReadOnly="True"
							MinWidth="90" />
						<data:DataGridCheckBoxColumn 
							Header="Disabled" 
		                    Width="SizeToCells"
		                    Binding="{Binding IsDisabled}" 
							IsReadOnly="True"
							MinWidth="70" 	/>
						<data:DataGridTextColumn 
							Header="Created" 
							Width="SizeToCells"
							Binding="{Binding Path=InsertedLocal, Converter={StaticResource DateTimeConverter}}" 
							IsReadOnly="True"
							MinWidth="100" />
						<data:DataGridTemplateColumn Header="Delete" MinWidth="100">
							<data:DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
									<TextBlock Cursor="Hand" Foreground="Purple" Text="delete" TextDecorations="Underline" MouseLeftButtonUp="DeleteSIPAccount" HorizontalAlignment="Center" />
								</DataTemplate>
							</data:DataGridTemplateColumn.CellTemplate>
						</data:DataGridTemplateColumn>
		 			</data:DataGrid.Columns>
				</data:DataGrid>
			</Border>
		</sipsorceryui:AssetViewPanel>
		<sipsorceryui:AssetViewPanel Height="Auto" x:Name="m_sipBindingsPanel" Width="Auto" Margin="0,5,0,5" MinWidth="1024" MinHeight="222">
			<Border BorderBrush="#FFA1FA28" BorderThickness="1,1,1,1" Height="222" x:Name="m_sipBindingsBorder" Width="1024">
				<data:DataGrid ColumnHeaderHeight="24" SelectionMode="Single" x:Name="m_bindingsGrid" AutoGenerateColumns="False" FontSize="11" 
				RowBackground="Azure"
				AlternatingRowBackground="LightSteelBlue" Height="Auto" Width="Auto">
				<data:DataGrid.Columns>
					<data:DataGridTextColumn 
						Header="SIP Account" 
						Width="SizeToCells"
						Binding="{Binding Path=SIPAccountName}" 
						IsReadOnly="True"
						MinWidth="150"/>
					<data:DataGridTextColumn 
		                Header="Owner" 
		                Width="SizeToCells"
		                Binding="{Binding Owner}" 
						IsReadOnly="True"
						MinWidth="80" />
					<data:DataGridTextColumn 
						Header="Contact URI" 
						Width="SizeToCells"
						Binding="{Binding Path=MangledContactURI}" 
						IsReadOnly="True"
						MinWidth="180"/>
					<data:DataGridTextColumn 
						Header="Last Update" 
						Width="SizeToCells"
						Binding="{Binding Path=LastUpdateLocal, Converter={StaticResource DateTimeConverter}}" 
						IsReadOnly="True"
						MinWidth="100" />
					<data:DataGridTextColumn 
						Header="Expiry" 
						Width="SizeToCells"
						Binding="{Binding Path=Expiry}" 
						IsReadOnly="True"
						MinWidth="60" />
					<data:DataGridTextColumn 
						Header="Remote Socket" 
						Width="SizeToCells"
						Binding="{Binding Path=RemoteSIPSocket}" 
						IsReadOnly="True"
						MinWidth="90" />
					<data:DataGridTextColumn 
						Header="Proxy Socket" 
						Width="SizeToCells"
						Binding="{Binding Path=ProxySIPSocket}" 
						IsReadOnly="True"
						MinWidth="90" />
					<data:DataGridTextColumn 
						Header="User Agent" 
						Width="SizeToCells"
						Binding="{Binding Path=UserAgent}" 
						IsReadOnly="True"
						MinWidth="150" />
				</data:DataGrid.Columns>
			</data:DataGrid>
			</Border>
		</sipsorceryui:AssetViewPanel>

	</StackPanel>
</UserControl>